<!--toggleClass.html-->
<span class="a b">classList is 'a b'</span>

<script>
    const span = document.querySelector("span");
    const classes = span.classList;

    span.addEventListener("click", () => {
        const result = classes.toggle("c");
        span.textContent = `'c' ${
            result ? "added" : "removed"
        }; classList is now "${classes}".`;
    });
</script>
